package com.tywj.panda.travel.route

import android.app.Activity
import com.tywj.lib.core.common.view.BaseFragment
import com.tywj.lib.route.RouteNavigation
import com.tywj.panda.customer.common.entity.TravelEntity
import com.tywj.panda.travel.details.TravelDetailsActivity
import com.tywj.panda.travel.details.TravelTicketTransFerActivity


/**
 * @desc 行程组件Native路由
 * @author June Yang
 * @date 2020/5/9
 */
object TravelRoute {
    // 行程
    const val TRAVEL = "/travel/travel"


    // 行程组件服务
    const val TRAVEL_SERVICE = "/travel/travelService"

    const val TRAVEL_DETAILS = "/travel/travelServiceDetails"

    //多人车票
    const val TRAVEL_DETAILS_STATUS = "/travel/travelServiceDetailsStatus"

    //车票转让
    const val TRAVEL_TICKETS_TRANSFER = "/travel/travelTransfer"

    //历史行程
    const val TRAVEL_HISTORY = "/travel/history"


    /**
     * 获取行程Fragment
     */
    fun getTravelFragment(activity: Activity): BaseFragment {
        return RouteNavigation(TRAVEL)
            .navigation(activity) as BaseFragment
    }

    fun toTravelDetails(bean: TravelEntity.DataBean): RouteNavigation {
        return RouteNavigation(TRAVEL_DETAILS)
            .param(TravelDetailsActivity.PARAMS_TRAVEL_ENTITY, bean)

    }

    fun toTicketTransfer(id: String): RouteNavigation {
        return RouteNavigation(TRAVEL_TICKETS_TRANSFER).param(TravelTicketTransFerActivity.PARAMS_ID, id)
    }

    fun toTravelHistory(): RouteNavigation {
        return RouteNavigation(TRAVEL_HISTORY)
    }
}